/**
* 
*	ExpressController类
*	作者：邓磊
*	时间：2016年7月4日 16:40:43
*	作用：提供企业快递的功能
*	域：/weixin/user
*
*/

package com.eptok.weixin.action;


import java.math.BigDecimal;
import java.math.RoundingMode;
import java.net.URLEncoder;
import java.util.Date;
import java.util.HashMap;
import java.util.List;
import java.util.Map;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import org.apache.log4j.Logger;
import org.hibernate.envers.tools.StringTools;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.ResponseBody;
import org.springframework.web.servlet.ModelAndView;

import com.eptok.weixin.util.AESUtil;
import com.eptok.weixin.util.WxCooikeManager;

import hikefa.core.global.GlobalCache;
import hikefa.core.remote.client.RemoteCall;
import hikefa.core.util.StringUtil;
import hikefa.core.web.page.Pager;
import hikefa.core.web.page.Paginater;
import net.sf.json.JSONObject;
import yspay.express.bean.Result;
import yspay.express.entity.ExpressParam;
import yspos.cpfs.enumeration.ExpBasicStatus;
import yspos.cpfs.enumeration.ExpForPublicStatus;
import yspos.cpfs.enumeration.ExpInfoStatus;
import yspos.cpfs.express.entity.ExpBizNotify;
import yspos.cpfs.express.entity.ExpExpressInfo;
import yspos.cpfs.express.entity.ExpUserinfo;
import yspos.cpfs.express.entity.Query;
import yspos.cpfs.remoteserver.iface.IExpressService;
import yspos.remoteserver.iface.IYsServer;
import yspos.trade.bean.cust.UserInfo;


@Controller
@RequestMapping("/weixin/user")
public class ExpressController  extends BaseDispatchAction{
	private static final Logger log = Logger.getLogger(ExpressController.class);
	private IExpressService expressServer = (IExpressService) RemoteCall.getRemoteObject(IExpressService.class);
	private IYsServer ysServer = (IYsServer) RemoteCall.getRemoteObject(IYsServer.class);
	private static String lastVV = null;
	private static String lastLogNo = null;
	
	/*
	 * 进入我的快递
	 */
	@RequestMapping(value = { "/expressMySend.do" })    
	public ModelAndView expressMySend(HttpServletRequest request, HttpServletResponse response,Query q,
			Long pageNumber,Long pageNumber2) 
	{
		Pager pageS=new Pager();
		pageS.setPageSize(5);
		pageS.setPageNumber(pageNumber!=null?pageNumber.longValue():1l);
		if(pageS.getPageNumber()<1)
			pageS.setPageNumber(1l);
		q.setUserId(WxCooikeManager.getUser(request).getId());
		Paginater pageer = null;
		
		try {
			pageer = expressServer.getMySendExpress(q, pageS);
			request.setAttribute("qSend", q);
			request.setAttribute("objsSend", pageer);
			request.setAttribute("statesSend", ExpInfoStatus.mVals);
			
			//查询默认收件列表
			Pager pageR=new Pager();
			pageR.setPageSize(5);
			pageR.setPageNumber(pageNumber2!=null?pageNumber2.longValue():1l);
			if(pageR.getPageNumber()<1)
				pageR.setPageNumber(1l);
			Paginater pageer2 = expressServer.getMyReceiveExpress(q, pageR);
			request.setAttribute("qReceive", q);
			request.setAttribute("objsReceive", pageer2);
			request.setAttribute("statesReceive", ExpInfoStatus.mVals);
			
			request.setAttribute("flag", "jikd");
			return new ModelAndView(PATH+"/express/expressNew");
		} catch (Exception e) {
			return toFail(request, "1", "获取我的快递失败");
		}
		
		
		
	}
	
	/*
	 * 进入我的快递
	 * (我的收快递列表)
	 */
	@RequestMapping(value = { "/expressMyReceive.do" })    
	public ModelAndView expressMyReceive(HttpServletRequest request, HttpServletResponse response
			,Query q,Long pageNumber,Long pageNumber2) 
	{
		Pager pageR=new Pager();
		pageR.setPageSize(5);
		pageR.setPageNumber(pageNumber2!=null?pageNumber2.longValue():1l);
		if(pageR.getPageNumber()<1)
			pageR.setPageNumber(1l);
		q.setUserId(WxCooikeManager.getUser(request).getId());
		Paginater pageer = null;
		try 
		{
			pageer = expressServer.getMyReceiveExpress(q, pageR);
			request.setAttribute("qReceive", q);
			request.setAttribute("objsReceive", pageer);
			request.setAttribute("statesReceive", ExpInfoStatus.mVals);
			
			//查询默认寄件列表
			Pager pageS=new Pager();
			pageS.setPageSize(5);
			pageS.setPageNumber(pageNumber!=null?pageNumber.longValue():1l);
			if(pageS.getPageNumber()<1)
				pageS.setPageNumber(1l);
			Paginater pageer2 = expressServer.getMySendExpress(q, pageS);
			request.setAttribute("qSend", q);
			request.setAttribute("objsSend", pageer2);
			request.setAttribute("statesSend", ExpInfoStatus.mVals);
			
			request.setAttribute("flag", "shoukd");
			return new ModelAndView(PATH+"/express/expressNew");
		} catch (Exception e) 
		{
			return toFail(request, "1", "获取我的快递失败");
		}
		
	}
	
	
	/*
	 * 进入寄快递页面
	 */
	@RequestMapping(value = { "/expressSendPre.do" })    
	@ResponseBody
	public Result expressSendPre(HttpServletRequest request, HttpServletResponse response) 
	{
		ExpUserinfo user = WxCooikeManager.getUser(request);
		
		//首先查看此人是否加入了企业 
		/*由于未加入企业同样也能寄快递，所以，去掉这一项限制*/
		/*List opers = expressServer.getOperationsByuid(user.getId());
		if(opers == null || opers.size() == 0)
		{
			return Result.init("2", "您还没有加入任何企业，或者企业没有设置运营点，请先加入企业再操作");
		}*/
		Result notPay = expressServer.expressNotPay(user);
		if(!notPay.isOk())
		{
			return notPay;
		}
		return Result.init("0", "ok");
	}
	
	/*
	 * 获取附近的运营点（根据定位）
	 */
	@RequestMapping(value = { "/expressGetNearbyOper.do" })    
	@ResponseBody
	public Result expressGetNearbyOper(HttpServletRequest request, HttpServletResponse response) 
	{
		ExpUserinfo user = WxCooikeManager.getUser(request);
		
		String lat = WxCooikeManager.getCookieValue("point.lat",request);
		String lng = WxCooikeManager.getCookieValue("point.lng",request);
		if(!StringUtil.isBlank(lat) && !StringUtil.isBlank(lng))
		{
			List l = expressServer.getOperationsNearBy(new BigDecimal(lat), new BigDecimal(lng), 5, user.getId());
			return Result.init("0", "ok", l);
		}else	
		{
			return Result.init("0", "no result");
		}
	}
	
	
	/*
	 * 进入寄快递页面
	 */
	@RequestMapping(value = { "/expressSend.do" })    
	public ModelAndView expressSend(HttpServletRequest request, HttpServletResponse response) 
	{
		//查询此人是否有未支付的快递信息 如果有 不能发件
		ExpUserinfo user = WxCooikeManager.getUser(request);
		List addrs = expressServer.getAddrByUID(user.getId());
		List opers = expressServer.getOperationsByuid(user.getId());
		
		request.setAttribute("addrs", addrs);
		request.setAttribute("opers", opers);
		return new ModelAndView(PATH+"/express/expressSend");
	}
	
	/*
	 * 创建订单
	 */
	@RequestMapping(value = { "/expressCreate.do"} , method = RequestMethod.POST)
	public Object expressCreate(HttpServletRequest request, HttpServletResponse response,ExpressParam param,String vv) 
	{
		if(vv == null || vv.equals(lastVV))
		{
			return toFail(request, "1", "参数异常或者请求重复");
		}
		lastVV = vv;
		ExpUserinfo user = WxCooikeManager.getUser(request);
		log.info("用户["+user.getName()+"] 已经提交订单，开始处理...");
		if(null == param)
		{
			return toFail(request, "1", "参数异常");
		}
		try 
		{
			Result ret = expressServer.expressInfoCreate(param, user);
			log.debug("用户["+user.getName()+"] 处理结果："+ret.getMsg());
			if(ret.getCode().equals("0"))
			{
				ExpExpressInfo info =(ExpExpressInfo)ret.getObj();
				String url = "expressDetail.do?sn="+info.getSn();
				return "redirect:"+url;
			}else
			{
				return toFail(request, ret.getCode(), ret.getMsg());
			}
		} catch (Exception e) {
			e.printStackTrace();
			log.debug("用户["+user.getName()+"] 处理失败：原因："+e.getMessage());
			return toFail(request, "1", "提交失败："+e.getMessage());
		}
	}
	
	
	/*
	 * 撤单
	 */
	@RequestMapping(value = { "/expressCancel.do"})
	@ResponseBody
	public Object expressCancel(HttpServletRequest request, HttpServletResponse response,
			String sn) 
	{
		ExpUserinfo user = WxCooikeManager.getUser(request);
		if(StringUtil.isEmpty(sn))
		{
			return toFail(request, "1", "撤单失败：参数异常");
		}
		try 
		{
			Result ret = expressServer.expressInfoCancel(sn, user);
			return ret;
		} catch (Exception e) {
			return Result.init("1", "撤单失败："+e.getMessage());
		}
	}
	
	/*
	 * 进入揽件递页面
	 */
	@RequestMapping(value = { "/toExpressLanshou.do" })    
	public ModelAndView toExpressLanshou(HttpServletRequest request, HttpServletResponse response,String barcode) 
	{
		request.setAttribute("obj", null);
		request.setAttribute("tip", null);
		ExpUserinfo user = WxCooikeManager.getUser(request);
		if(!StringUtil.isEmpty(barcode))
		{
			ExpExpressInfo info = expressServer.getExpressInfoByBarcode(barcode);
			if(info != null)
			{
				/*记录扫码操作*/
				try {
					expressServer.saveExpressLog(info.getSn(),user , 
							ExpInfoStatus.getItemOf(info.getState()).toString(),
							ExpInfoStatus.getItemOf(info.getState()).toString(), "[揽件] 扫条形码");
				} catch (Exception e) {
					log.error("记录扫码操作失败（揽收扫码，操作人："+user.getName()+"）");
				}
				
				if(info.getState().equals(ExpInfoStatus.WAIT_SEND.value))
				{
					//判断该运营点是否 加入
					if(expressServer.checkExperByOperId(user.getId(), info.getFromOperationAddrId(),info.getExpressMercNo()))
					{
						//如果是商家计费，必须要计费后才能揽收
						if("ON".equalsIgnoreCase(info.getMercBillSign()))
						{
							if(info.getAmount().compareTo(BigDecimal.ZERO) == 0 )
							{
								request.setAttribute("tip", "暂时无法揽收此快件");
							}else
							{
								request.setAttribute("obj", info);
							}
						}else
						{
							request.setAttribute("obj", info);
						}
					}else
					{
						request.setAttribute("tip", "您不能揽收此快件");
					}
				}else
				{
					request.setAttribute("tip", "该订单已经撤销或者揽收");
				}
			}else
			{
				request.setAttribute("tip", "该单号无订单信息");
			}
		}
		request.setAttribute("barcode", barcode);
		return new ModelAndView(PATH+"/express/expressLanshou");
	}
	
	/*
	 * 进入派件递页面
	 */
	@RequestMapping(value = { "/toExpressDilivery.do" })    
	public ModelAndView toExpressDilivery(HttpServletRequest request, HttpServletResponse response,String expNo) 
	{
		request.setAttribute("obj", null);
		if(!StringUtil.isEmpty(expNo))
		{
			ExpExpressInfo info = expressServer.getExpressInfoByExpNo(expNo);
			ExpUserinfo user= WxCooikeManager.getUser(request);
			if(info != null)
			{
				/*派件扫快递单操作*/
				try {
					expressServer.saveExpressLog(info.getSn(), user, 
							ExpInfoStatus.getItemOf(info.getState()).toString(), 
							ExpInfoStatus.getItemOf(info.getState()).toString(), "[派件] 扫快递单");
				} catch (Exception e) {
					log.error("记录扫码操作失败（派件扫码，操作人："+user.getName()+"）");
				}
			}
			if(info != null && info.getState().equals(ExpInfoStatus.SENDING.value))
			{
				request.setAttribute("obj", info);
			}
		}
		request.setAttribute("expNo", expNo);
		return new ModelAndView(PATH+"/express/expressDilivery");
	}
	
	/*
	 * 派件
	 */
	@RequestMapping(value = { "/expressDilivery.do"})
	@ResponseBody
	public Object expressDilivery(HttpServletRequest request, HttpServletResponse response,
			String sn) 
	{
		ExpUserinfo user = WxCooikeManager.getUser(request);
		if(StringUtil.isEmpty(sn))
		{
			return toFail(request, "1", "派件失败：参数异常");
		}
		try
		{
			Result ret = expressServer.expressInfoDilivery(sn, user);
			return ret;
		} catch (Exception e) {
			return Result.init("1", "撤单失败："+e.getMessage());
		}
	}
	
	/*
	 * 进入我揽收收快递列表页面
	 */
	@RequestMapping(value = { "/expressMyLanshou.do" })    
	public ModelAndView expressMyLanshou(HttpServletRequest request, HttpServletResponse response,Query q,Pager page) 
	{
		page.setPageSize(5);
		q.setUserId(WxCooikeManager.getUser(request).getId());
		Paginater pageer = null;
		
		try {
			pageer = expressServer.getMyLanshouExpress(q, page);
			request.setAttribute("q", q);
			request.setAttribute("objs", pageer);
			request.setAttribute("states", ExpInfoStatus.mVals);
			return new ModelAndView(PATH+"/express/expressMyLanshou");
		} catch (Exception e) {
			return toFail(request, "1", "获取我的快递失败");
		}
	}
	
	/*
	 * 进入我的派件列表
	 */
	@RequestMapping(value = { "/expressMyDilivery.do" })    
	public ModelAndView expressMyDilivery(HttpServletRequest request, HttpServletResponse response,Query q,Pager page) 
	{
		page.setPageSize(5);
		q.setUserId(WxCooikeManager.getUser(request).getId());
		Paginater pageer = null;
		try 
		{
			pageer = expressServer.getMyDiliveryExpress(q, page);
			request.setAttribute("q", q);
			request.setAttribute("objs", pageer);
			request.setAttribute("states", ExpInfoStatus.mVals);
			return new ModelAndView(PATH+"/express/expressMyDilivery");
		} catch (Exception e) 
		{
			return toFail(request, "1", "获取我的快递失败");
		}
	}
	

	/*
	 * 进入各网店剩余派件量页面
	 */
	@RequestMapping(value = { "/expressSplOrder.do" })    
	public ModelAndView expressSplOrder(HttpServletRequest request, HttpServletResponse response,Query q,Pager page) 
	{
		page.setPageSize(50);
		q.setUserId(WxCooikeManager.getUser(request).getId());
		Paginater pageer = null;
		try {
			pageer = expressServer.expressSumAllGroup(q, page);
			request.setAttribute("objs", pageer);
			return new ModelAndView(PATH+"/express/expressSplOrder");
		} catch (Exception e) {
			return toFail(request, "1", "获取我的快递失败");
		}
	}
	
	@RequestMapping(value = { "/expressPick.do" })    
	@ResponseBody
	public Result expressPick(HttpServletRequest request, HttpServletResponse response,String sn) 
	{
		try{
			ExpBizNotify para = new ExpBizNotify();para.setNotifyNo(sn);
			ExpBizNotify bizNotify = expressServer.findNotify(para);
			if(bizNotify!=null){
				bizNotify.setPickState("01");
				bizNotify.setPickTime(new Date());
			}
			expressServer.updateNotifyBean(bizNotify);
			return Result.init("0", "操作成功");
		}catch(Exception e){
			e.printStackTrace();
			return Result.init("0", "操作失败:"+e.getMessage());
		}

	}
	
	
	/*
	 * 根据个人选择的运营点，商户号，选择快递公司
	 */
	@ResponseBody
	@RequestMapping(value = { "/getExpressComps.do" })    
	public Object getExpressTypes(HttpServletRequest request, HttpServletResponse response,
			String mercNo,String operId) 
	{
		
		try
		{
			List l = expressServer.getExpressTypes(mercNo, operId);
			return Result.init("0", "ok",l);
		} catch (Exception e) 
		{
			return Result.init("1", "获取失败");
		}
	}
	
	/*
	 * 根据个人选择的运营点，商户号，选择快递公司
	 */
	@ResponseBody
	@RequestMapping(value = { "/bindBarCode.do" })    
	public Object bindBarCode(HttpServletRequest request, HttpServletResponse response,
			String sn,String barcode) 
	{
		try
		{
			Result ret = expressServer.bindBarcode(sn, barcode, WxCooikeManager.getUser(request));
			return ret;
		} catch (Exception e) 
		{
			return Result.init("1", "获取失败"+e.getMessage());
		}
	}
	
	/*
	 * 揽件
	 * 根据个人选择的运营点，商户号，选择快递公司+
	 * 此功能将订单状态改成：已揽收 同时，给客户推送支付消息
	 */
	@ResponseBody
	@RequestMapping(value = { "/bindExpCode.do" })    
	public Object expressLanshou(HttpServletRequest request, HttpServletResponse response,
			String sn,String expcode) 
	{
		try
		{
			Result ret = expressServer.bindExpcode(sn, expcode, WxCooikeManager.getUser(request));
			return ret;
		} catch (Exception e) 
		{
			return Result.init("1", "获取失败"+e.getMessage());
		}
	}
	
	/*
	 * 快递明细(本人)
	 */
	@RequestMapping(value = { "/expressDetail.do" })    
	public ModelAndView expressDetail(HttpServletRequest request, HttpServletResponse response,String sn) 
	{
		ExpUserinfo user = WxCooikeManager.getUser(request);
		ExpExpressInfo info = expressServer.getExpressInfoBySn(sn);
		if(null == info)
		{
			return toFail(request, "1", "订单信息不存在("+sn+")");
		}
		if(!user.getId().equals(info.getBizUserId()))
		{
			return toFail(request, "1", "非本人不可见");
		}
		request.setAttribute("user", user);
		request.setAttribute("obj", info);
		request.setAttribute("states", ExpInfoStatus.mVals);
		return new ModelAndView(PATH+"/express/expressDetail");
	}
	
	/*
	 * 快递明细（非本人）
	 */
	@RequestMapping(value = { "/expressDetailOther.do" })    
	public ModelAndView expressDetailOther(HttpServletRequest request, HttpServletResponse response,String sn) 
	{
		ExpUserinfo user = WxCooikeManager.getUser(request);
		ExpExpressInfo info = expressServer.getExpressInfoBySn(sn);
		if(null == info)
		{
			return toFail(request, "1", "订单信息不存在("+sn+")");
		}
		request.setAttribute("user", user);
		request.setAttribute("obj", info);
		request.setAttribute("states", ExpInfoStatus.mVals);
		return new ModelAndView(PATH+"/express/expressDetailOther");
	}
	
	/*
	 * 计价
	 */
	@RequestMapping(value = { "/changePrice.do" })
	@ResponseBody
	public Result changePrice(HttpServletRequest request, HttpServletResponse response,String sn,
			BigDecimal price,BigDecimal weight) 
	{
		try {
			Result ret = expressServer.changePrice(sn, price, weight,WxCooikeManager.getUser(request));
			return ret;
		} catch (Exception e) {
			e.printStackTrace();
			return Result.init("1", "修改失败："+e.getMessage());
		}
	}
	
	/*
	 * 进入支付页面 创建订单
	 */
	@RequestMapping(value = { "/goPay.do" })
	public Object goPay(HttpServletRequest request, HttpServletResponse response,String sn,String vv) 
	{
		try {
			if(vv != null && vv.equals(lastVV))
			{
				log.error("支付请求重复----------------");
				return null;//重复
			}
			lastVV = vv;
			ExpUserinfo user = WxCooikeManager.getUser(request);
			if(user == null)
			{
				return toFail(request, "1", "未获取到用户信息");
			}
			
			ExpExpressInfo info = expressServer.getExpressInfoBySn(sn);
			if(null == info)
			{
				return toFail(request, "1", "订单号不存在:"+sn);
			}
			if(ExpForPublicStatus.PUBLIC.value.equals(info.getForPublic()))
			{
				return toFail(request, "1", "对公快递无须支付");
			}
			if(info.getAmount().compareTo(BigDecimal.ZERO) < 0)
			{
				return toFail(request, "1", "该订单未到支付环节");
			}
			if(ExpBasicStatus.ACTIVE.value.equals(info.getPayState()))
			{
				return toFail(request, "1", "该订单已经支付");
			}
			if(!info.getBizUserId().equals(user.getId()))
			{
				return toFail(request, "1", "您不能支付他人订单");
			}
			String payMiddleMercNo=info.getPayMiddleMercNo();
			UserInfo middleMercInfo = ysServer.getUserInfoByUserCode(payMiddleMercNo);
			if(null == middleMercInfo)
			{
				return toFail(request, "1", "支付失败：中间商户不存在（"+payMiddleMercNo+"）");
			}
			
//			if(StringUtil.isEmpty(middleMercInfo.getTrmNo()))
//			{
//				return toFail(request, "1", "中间商户未绑定终端号，不能支付");
//			}
			
			//生成支付订单号 **注意 此处是用中间账户做的支付
			Map<String,String> pMap = ysServer.getTransInfo(payMiddleMercNo);
			String logNo = pMap.get("logNo");
			String acDt  = pMap.get("acDt");
			if(StringUtil.isEmpty(logNo) || StringUtil.isEmpty(acDt))
			{
				return toFail(request, "1", "发起支付失败：获取支付订单失败");
			}
			Result ret = expressServer.expressInfoPayReady(info.getSn(), logNo,acDt);
			
			if(!ret.isOk())
			{
				return toFail(request, ret.getCode(), "发起支付失败："+ret.getMsg());
			}
			
			String orderAmt = info.getAmount().setScale(2, RoundingMode.DOWN).toString();
			
			Map<String, String> map = new HashMap<String, String>();
			map.put("mercName", middleMercInfo.getUsername());
			map.put("mercId",   middleMercInfo.getUserCode());
//			map.put("trmNo",    middleMercInfo.getTrmNo());
			map.put("logNo", logNo);
			map.put("orderAmt", orderAmt);
			
			
			String rdcurl = "http://weixin.ysepay.com/weixinManager/msg/tg/wechatInterface.do?token="+AESUtil.mapToEncrypt(map);;
			rdcurl = URLEncoder.encode(rdcurl,"UTF-8");
			
			String url = GlobalCache.getSystemCache("wx_pay_url");
			url = url.replace("rdcurl", rdcurl);
			
			/*记录进入支付的操作*/
			try {
				expressServer.saveExpressLog(info.getSn(), user, 
						ExpInfoStatus.getItemOf(info.getState()).toString(), 
						ExpInfoStatus.getItemOf(info.getState()).toString(), "[支付] 进入支付页面");
			} catch (Exception e) {
				log.error("记录进入支付页面操作失败（进入支付，操作人："+user.getName()+"）");
			}
			
			log.info("请求支付的连接："+url);
			return toRedirect(url);
			
		} catch (Exception e) {
			e.printStackTrace();
			return toFail(request, "1", "发起支付失败："+e.getMessage());
		}
	}
	
	@RequestMapping(value = { "/getNotLanshou.do" })    
	@ResponseBody
	public Result getNotLanshou(HttpServletRequest request, HttpServletResponse response)
	{
		try {
			ExpUserinfo user = WxCooikeManager.getUser(request);
			if(null == user)
			{
				return Result.init("0", "",0);
			}
			return expressServer.expressSumAll(user);
		} catch (Exception e) {
			e.printStackTrace();
			return Result.init("1","",0);
		}
	}
	
	/*
	 * 进入调试页面
	 */
	@RequestMapping(value = { "/debug.do" })    
	public ModelAndView debug(HttpServletRequest request, HttpServletResponse response,
			String key,Integer type) 
	{
		ExpUserinfo user = WxCooikeManager.getUser(request);
		if(null == user || !user.getPhone().equals("13411897029"))
		{
			return toFail(request, "1", "您无法使用此页面");
		}
		request.setAttribute("ret", "");
		request.setAttribute("key"+type, key);
		request.setAttribute("type", type);
		ExpExpressInfo info = null;
		if(!StringTools.isEmpty(key) && null != type)
		{
			switch (type) {
			case 1:
				info = expressServer.getExpressInfoBySn(key);
				break;
			case 2:
				info = expressServer.getExpressInfoByBarcode(key);
				break;
			case 3:
				info = expressServer.getExpressInfoByExpNo(key);
				break;	
			default:
				break;
			}
			if(null != info)
			{
				request.setAttribute("ret", JSONObject.fromObject(info).toString());
			}else
			{
				request.setAttribute("ret", "无此订单");
			}
		}
		return new ModelAndView(PATH+"/express/expressDebugger");
	}
	
	
	
}
